import java.util.Arrays;

//实现冒泡排序
public class sort {
    public static void Sort(int[] arr) {
        for (int i = 0; i < arr.length-1; i++) {
            for (int j = 1; j < arr.length; j++) {
                if (arr[j - 1] > arr[j]) { //j从1开始 使用j的下标
                    int temp = arr[j - 1];
                    arr[j - 1] = arr[j];
                    arr[j] = temp;
                }
            }
        }
    }
    public static void main(String[] args) {
        int[]arrays={1,0,8,78,98,7};
        Sort(arrays);
        System.out.println(Arrays.toString(arrays));
        }
}
